class Solution {
public:
    int maximumSum(vector<int>& arr) {
        int dp0=arr[0],dp1=0,max1=arr[0];
        for(int i=1;i<arr.size();i++){
           dp1 = max(dp0, dp1 + arr[i]);
            dp0 = max(dp0, 0) + arr[i];
            max1 = max(max1, max(dp0, dp1));

        }
        return max1;
    }
};
